package com.jarvis.hospital.prescription.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jarvis.hospital.R;
import com.jarvis.hospital.patient.model.MessageModel;
import com.jarvis.hospital.prescription.model.CommentModel;

import java.util.List;

/**
 * Created by jarvis.liu on 9/12/2016.
 */
public class CommentAdapter extends BaseQuickAdapter<CommentModel> {
    public CommentAdapter(int layoutResId, List<CommentModel> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, CommentModel commentModel) {
        TextView tv_comment = baseViewHolder.getView(R.id.tv_comment);
        ImageView iv_avatar = baseViewHolder.getView(R.id.iv_avatar);
        TextView tv_name = baseViewHolder.getView(R.id.tv_name);
        TextView tv_time = baseViewHolder.getView(R.id.tv_time);
        tv_name.setText(commentModel.getOwnerUserName());
        tv_time.setText(commentModel.getCommentTime());
        Glide.with(mContext)
                .load(commentModel.getOwnerUserHeadImg())
                .error(R.mipmap.ic_launcher)
                .into(iv_avatar);
        if("1".equals(commentModel.getCommentType())){
            tv_comment.setText("回复 "+commentModel.getTargetUserName()+":"+commentModel.getContent());
        }else {
            tv_comment.setText(commentModel.getContent());
        }
    }
}
